package org.zhadoop.stream.cql.semanticanalyzer.analyzecontext.expressiondesc;

import java.util.ArrayList;
import java.util.List;

import org.zhadoop.stream.cql.executor.BinaryExpression;
import org.zhadoop.stream.cql.executor.expressioncreater.BinaryExpressionCreator;
import org.zhadoop.stream.cql.executor.operatorinfocreater.ExpressionCreatorAnnotation;

/**
 * 二元表达式描述
 * 包含对逻辑表达式、算术表达式和关系表达式的描述
 * @author zwd
 *
 */
@ExpressionCreatorAnnotation(BinaryExpressionCreator.class)
public class BinaryExpressionDesc implements ExpressionDescribe{
	/**
	 * 二元表达 式信息
	 */
	private BinaryExpression bexpression;
	
	private List<ExpressionDescribe> argExpressions = new ArrayList<>();

	public BinaryExpressionDesc(BinaryExpression bexpression) {
		super();
		this.bexpression = bexpression;
	}
	
	@Override
	public String toString() {
		return "(" + argExpressions.get(0).toString() + " " + bexpression.getType().getDesc() + " "
	            + argExpressions.get(1).toString() + ")";
	}

	public BinaryExpression getBexpression() {
		return bexpression;
	}

	public void setBexpression(BinaryExpression bexpression) {
		this.bexpression = bexpression;
	}

	public List<ExpressionDescribe> getArgExpressions() {
		return argExpressions;
	}

	public void setArgExpressions(List<ExpressionDescribe> argExpressions) {
		this.argExpressions = argExpressions;
	}
}
